<!--Generate by Kevin's CodeBuilder 2022-01-27 15:22:39-->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <head th:replace="source::header">
    </head>
</head>
<body>
    <div id="k_page_erea" class="form_main_wrap">
        <div class="k_form_grid">
            <table id="datagrid"></table>
        </div>
        <div class="k_form_condition" style="padding:12px 14px;">
            <table class="k_form_table" id="k_form_query_wrap">
                <tr>
                    <td class="label label100">[(${Lang.common_query_from})]</td>
                    <td>
                        <input id="keywords" name="keywords" placeholder="用户名" class="form_input form_input30" type="text" />
                        <span>
                            <span style="padding-left: 10px;">时间范围：<input type="text" id="start_day" th:value="${preDay}" />
                                <span style="padding: 0 12px;">~</span><input type="text" id="end_day" th:value="${nowDay}" />
                            </span>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="padding-left:118px">
                        <button class="k_common_button" id="search_btn">
                            <i class="fa fa-search"></i>
                            [(${Lang.common_search})]
                        </button>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <script type="application/javascript" th:inline="javascript">
         var curdObj,
             height = 440,
             gridOpts = [(${dataGridJson})],//获取datagrid配置json
             title = "[(${Lang.baselog_windowTitle})]";//国际化语言
             gridOpts.title = title;

         new $B.Calendar("#start_day", {
             fmt: 'yyyy-MM-dd hh:mm:ss',
             readonly: true
         });

         new $B.Calendar("#end_day", {
             fmt: 'yyyy-MM-dd hh:mm:ss',
             readonly: true
         });

         $B.DomUtils.onDomLoaded(function () {
             var dg =  document.getElementById("datagrid");
             //设置查询参数
             gridOpts.setParams = function(){
                 return {
                     userName: $B.trimFn( document.getElementById("keywords").value),
                     start:document.getElementById("start_day").value,
                     end:document.getElementById("end_day").value
                 };
             };
             gridOpts.title = "";
             gridOpts.pageArea = "k_page_erea";
             gridOpts.fit2height = true;
             gridOpts.oprColWidth = 235;
             //gridOpts.showLoading = false;
             //gridOpts.idField = "id";
             gridOpts.sortField = {"createTime" : "desc"};
             gridOpts.formatTipFn = function(fieldName,data){
                 console.log("formatTIpN ",fieldName,data);
                 if(data.menuName === "菜单管理"){
                     return "#088927";
                 }else if(data.menuName === "角色管理"){
                     let rName = "";
                     try{
                         let oprData = JSON.parse( data.operateData);
                         rName = "-"+oprData[0].roleName;
                         console.log(oprData);
                     }catch (e) {
                     }
                     return {
                         text:"<div><h6 style='color: #FFFFFF'>提示：</h6><p style='color: #FFFFFF'>" +data.menuName+" ; " + data.content+""+rName +"</p></div>",
                         color:"#2E55E5"
                     };
                 }
             };
             curdObj = new $B.CURD(dg, gridOpts);

             //输入框绑定清理按钮
             $B.bindInputClear("k_form_query_wrap");

             $B.DomUtils.click(document.getElementById("search_btn"),()=>{
                  curdObj.reload();
             });
         });
         //打开form.html
        function _openForm(prs,isUpdate,winTitle){
             var opts = {
                 dataType:'html',
                 title:winTitle ? winTitle:title,
                 width:800,
                 height:height
             };
             if(prs){
                 opts.params = prs;
             }
             curdObj.window(opts,isUpdate);
         };
         /******工具栏事件集合******/
         window.buttonEvents = {
             deleteFn:function(prs){
                 curdObj.delChecked();
             }
         };
    </script>
</body>
</html>
